<template>
<div>
	<x-header>申请历史 <router-link to="/" slot="right"> <a class="fa fa-home fa-15x"></a> </router-link></x-header>
	<div>
		<ab-scroller v-if="InstanceStatus" url="/bpm/my/applyTaskList?supportMobile$V=true" :conditions='[{key:"subject_^VLK",value:"标题"},{key:"def_name_^VLK",value:"流程名"}]'>
			<div slot-scope="slotScope">
				<!-- <cell v-for="(apply,index) in slotScope.rows" :key="index" :title="apply.defName" :inline-desc="apply.subject" :link="{path:'/bpm/instanceDetail',query:{instanceId:apply.id,nodeId:'StartNoneEvent'}}" >
					<div>
						<span v-if="InstanceStatus[apply.status]" :class="'weui-btn weui-btn_mini weui-btn_plain-' + InstanceStatus[apply.status].labelCss">{{InstanceStatus[apply.status].value}}</span>
						<span v-else>无枚举：{{apply.status}}</span>
					</div>
				</cell> -->
				<div  v-for="(apply,index) in slotScope.rows" :key="apply.id" >
					<router-link :to="{path:'/bpm/instanceDetail',query:{instanceId:apply.id,nodeId:'StartNoneEvent'}}">
						<div class="gz-card gz-list-style">
							<div class="title-box">
							<slot name="title">
								<div class="card-item">
									<div class="card-item" style="flex: 1;">
										<div class="item-title">创建时间：</div>
										<div class="item-value">{{apply.createTime}}</div>
									</div>
									<div :class="'item-status weui-btn_plain-' + InstanceStatus[apply.status].labelCss">
										<span v-if="InstanceStatus[apply.status]">{{InstanceStatus[apply.status].value}}</span>
										<span v-else>无枚举：{{apply.status}}</span>
									</div>
								</div>
							</slot>
							<div class="left-dot"></div>
							<div class="right-dot"></div>
							</div>
							<div class="content-box">
							<slot name="content">
								<div class="card-items">
									<div class="card-item">
										<div class="item-title">任务标题：</div>
										<div class="item-value">{{apply.defName}}</div>
									</div>
									<div class="card-item">
										<div class="item-title">任务描述：</div>
										<div class="item-value">{{apply.subject}}</div>
									</div>
								</div>
							</slot>
							</div>
							<div class="footer-box">
							<slot name="footer">
								<div class="btn-group">
									<div class="btn btn-primary">查看</div>
								</div>
							</slot>
							</div>
						</div>
					</router-link>
				</div>
			</div>
		</ab-scroller>
	</div>
</div>
</template>

<script>

import Vue from 'vue';

export default {
	data: function () {
	  return {
		InstanceStatus : null
	  }
	},
	created : function(){
		var post = this.abTools.getEnum("com.dstz.bpm.api.constant.InstanceStatus",true);
		var that = this;
		post.then(function(data){
			that.InstanceStatus = {};
			data.forEach(function(item){
				that.InstanceStatus[item.key] = item;
				if(!item.labelCss||["default","success","primary"].includes(item.labelCss)){
					item.labelCss = "primary";
				}else{
					item.labelCss = "warn";
				}
			});
		});
	},
	methods: {
	}
}
</script>
<style scoped lang="less">
	/deep/._v-container{
		border-top: 0.5em solid rgba(0,0,0,0) !important;
	}
</style>